<?php
/**
 * Pipahr
 * Check user status, if user has logged out or token expired, the front will reload page
 */

OCP\JSON::checkLoggedIn();
OCP\JSON::callCheck();
$user = JFactory::getUser();
if(PFactory::isMasterUser() || PFactory::isJobseekerUser())
   JobHelper::updateUserActiveDate($user->id);
else 
   PCompanyHelper::updateSubUserActiveDate($user->get("username"));

// update session time. This is mainly for non-database session handler 
$app = PFactory::getApplication();
$app->updateSessionTime();

OCP\JSON::success(array('data'=>array('notification'=>DelayTaskJob::getNumActiveTasks(OC_User::getUser()))));
